<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 使用过滤器 -->
        <h1>{{phone | thPhone}}</h1>
        <h1>{{time|thTime}}</h1>
    </div>
</body>
</html>
<script src="./vue-2.5.21.js"></script>
<script>
    Vue.filter('thPhone',(p)=>{
        return p.slice(0,3)+'****'+p.slice(-4)
    })
    Vue.filter('thTime',(t)=>{
        return `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`
    })
    var v = new Vue({
        el:"#app",
        data:{
            phone:'13212344321',
            time:new Date()
        },
        // filters:{
        //     thPhone(p){
        //         return p.slice(0,3)+'****'+p.slice(-4)
        //     },
        //     thTime(t){
        //         return `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`
        //     }
        // }
    })
</script>